<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, user-scalable=no"/>
    <title>首页 - 光年(Light Year Admin)后台管理系统模板</title>
    <link rel="icon" href="favicon.ico" type="image/ico">
    <meta name="keywords" content="LightYear,光年,后台模板,后台管理系统,光年HTML模板">
    <meta name="description" content="LightYear是一个基于Bootstrap v3.3.7的后台管理系统的HTML模板。">
    <meta name="author" content="yinqi">

    <link th:href="@{/admin/css/bootstrap.min.css}" type="text/css" rel="stylesheet">
    <link th:href="@{/admin/css/materialdesignicons.min.css}" type="text/css" rel="stylesheet">
    <link th:href="@{/admin/css/style.min.css}" type="text/css" rel="stylesheet">

</head>

<body>
<div class="lyear-layout-web">
    <div class="lyear-layout-container">
        <!--左侧导航-->
        <aside class="lyear-layout-sidebar">

            <!-- logo -->
            <div id="logo" class="sidebar-header">
                <a th:href="@{/manage/index}"><img src="/admin/images/logo-sidebar.png" title="LightYear"
                                                   alt="LightYear"/></a>
            </div>
            <div class="lyear-layout-sidebar-scroll">

                <nav class="sidebar-main">
                    <ul class="nav nav-drawer">
                        <li class="nav-item active">
                            <a th:href="@{/manage/index}"><i class="mdi mdi-home"></i>后台首页</a>
                        </li>
                        <li class="nav-item ">
                            <a th:href="@{/manage/toNovel}"><i class="mdi mdi-book-open"></i> 书籍管理</a>
                        </li>
                        <li class="nav-item ">
                            <a th:href="@{/manage/recharge}"><i class="mdi mdi-diamond"></i> 充值管理</a>
                        </li>
                        <li class="nav-item ">
                            <a th:href="@{/manage/toComment}"><i class="mdi mdi-record"></i> 评论管理</a>
                        </li>
                        <li class="nav-item ">
                            <a th:href="@{/manage/toPassApply}"><i class="mdi mdi-compass"></i> 审批作家</a>
                        </li>
                        <li class="nav-item ">
                            <a th:href="@{/manage/system/param}"><i class="mdi mdi-brightness-5"></i> 系统设置</a>
                        </li>
                        <li class="nav-item ">
                            <a th:href="@{/manage/system/log}"><i class="mdi mdi-grease-pencil"></i> 系统日志</a>
                        </li>
                    </ul>
                </nav>
            </div>

        </aside>
        <!--End 左侧导航-->

        <!--头部信息-->
        <header class="lyear-layout-header">

            <nav class="navbar navbar-default">
                <div class="topbar">

                    <div class="topbar-left">
                        <div class="lyear-aside-toggler">
                            <span class="lyear-toggler-bar"></span>
                            <span class="lyear-toggler-bar"></span>
                            <span class="lyear-toggler-bar"></span>
                        </div>
                        <span class="navbar-page-title"> 充值管理 </span>
                    </div>

                    <ul class="topbar-right">
                        <li class="dropdown dropdown-profile">
                            <a href="javascript:void(0)" data-toggle="dropdown">
                                <img class="img-avatar img-avatar-48 m-r-10" th:src="${session.loginUser.imgSrc}"
                                     alt="笔下光年"/>
                                <span th:text="${session.loginUser.userName}"> <span class="caret"></span></span>
                            </a>
                            <ul class="dropdown-menu dropdown-menu-right">
                                <li><a th:href="@{/manage/toInfo}"><i class="mdi mdi-account"></i> 个人信息</a></li>
                                <li><a th:href="@{/manage/toChangePwd}"><i class="mdi mdi-lock-outline"></i> 修改密码</a>
                                </li>
                                <li><a th:href="@{/index}"><i class="mdi mdi-lock-outline"></i> 回到门户网站</a>
                                </li>
                                <li class="divider"></li>
                                <li><a th:href="@{/manage/logout}"><i class="mdi mdi-logout-variant"></i> 退出登录</a>
                                </li>
                            </ul>
                        </li>
                    </ul>

                </div>
            </nav>

        </header>
        <!--End 头部信息-->

        <!--页面主要内容-->
        <main class="lyear-layout-content">
            <div class="container-fluid">

                <div class="row">

                    <div class="col-lg-12">
                        <div class="card">
                            <div style="font-size: 18px;
                            padding-top: 15px;padding-bottom: 15px;padding-left: 50px;color: #0C0C0C;border-bottom: 2px"
                                 class="acc-top-tab">

                                <a href="/manage/recharge" style="margin-right: 15px">充值数额</a>|
                                <a href="/manage/recharge/toAdd" style="margin-left: 15px;color: black">新增充值数额</a>
                            </div>
                        </div>
                    </div>

                    <!--核心内容存放-->
                    <div class="col-md-6">
                        <div class="card">
                            <div class="card-header">
                                <h4>充值数额增加</h4>
                            </div>
                            <div class="card-body">

                                <form id="add-recharge" action="/manage/recharge/add" method="post">
                                    <div class="form-group">
                                        <label for="cost">普通充值比例为 1:100</label>
                                    </div>
                                    <div class="form-group">
                                        <label for="cost">花费金钱</label>
                                        <input class="form-control" type="number" id="cost"
                                               name="cost" placeholder="请输入花费得金钱..">
                                    </div>
                                    <div class="form-group">
                                        <label for="balance">获得虚拟币</label>
                                        <input class="form-control" type="number" id="balance"
                                               name="balance" placeholder="请输入获得的虚拟币..">
                                    </div>
                                    <div class="form-group">
                                        <button class="btn btn-primary" type="submit">增加</button>
                                    </div>
                                </form>

                            </div>
                        </div>

                    </div>


                </div>

            </div>

        </main>
        <!--End 页面主要内容-->
    </div>
</div>
<script type="text/javascript" th:src="@{/admin/js/jquery.min.js}"></script>
<script type="text/javascript" th:src="@{/admin/js/bootstrap.min.js}"></script>
<script type="text/javascript" th:src="@{/admin/js/perfect-scrollbar.min.js}"></script>
<script type="text/javascript" th:src="@{/admin/js/main.min.js}"></script>
<script type="text/javascript" th:src="@{/js/common.js}"></script>
<script type="text/javascript">

    $(function () {
        //监听表单提交
        $("#add-recharge").submit(function () {
            //获取数据
            let data = $("#add-recharge").serialize();

            $.ajax({
                url: "/manage/recharge/add",
                method: "post",
                data: data,
                success: function (result) {
                    if (result == true) {
                        alert("操作成功!");
                        location.href = "/manage/recharge";
                    } else if (result == false) {
                        alert("操作失败!");
                    } else {
                        alert(result.message);
                        if (result.message == '权限校验失败!') {
                            window.location.href = "/index";
                        }
                    }
                }
            });
            return false;
        });
    })

</script>
</body>
</html>